// pages/customer/component/customerList.js
const util = require("../../../utils/util.js");
Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多 slot 支持
  },
  /**
   * 组件的属性列表
   */
  properties: {
    listData: {
      type: Array,
      value: []
    },
    hasMaintenanceStaffName: {
      type: Boolean,
      value: false
    },
    hasLastMaintenanceStaffName: {
      type: Boolean,
      value: false
    },
    hasType: { // 含有类型：公司盘、个人盘
      type: Boolean,
      value: false
    },
    hasFunnels: {
      type: Boolean,
      value: false
    },
    leftWidth: {
      type: Number,
      value: 0
    },
    rightWidth: {
      type: Number,
      value: 0
    },
    hasLeft: {
      type: Boolean,
      value: false
    },
    hasLeft1: {
      type: Boolean,
      value: false
    },
    hasLeft2: {
      type: Boolean,
      value: false
    },
    hasRight: {
      type: Boolean,
      value: false
    },
    hasRight1: {
      type: Boolean,
      value: false
    },
    hasRight2: {
      type: Boolean,
      value: false
    },
    hasBusinessFlow: { // 显示业务进度
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    contract_list_pop_show: false,
    cur_contract_list: []
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onSwipeClose({
      detail: {
        position,
        instance
      }
    }) {
      //console.log('position', position);
      //console.log('instance', instance);
      switch (position) {
        case 'left':
        case 'right':
        case 'cell':
          console.log('cell');
          instance.close();
          break;
      }
    },
    clickLeft1(event) {
      //console.log('clickLeft1');
      this.triggerEvent('clickleft1', {
        id: event.currentTarget.dataset.id
      });
    },
    clickLeft2(event) {
      //console.log('clickLeft2');
      this.triggerEvent('clickleft2', {
        id: event.currentTarget.dataset.id
      });
    },
    clickRight1(event) {
      //console.log('clickRight1');
      this.triggerEvent('clickright1', {
        id: event.currentTarget.dataset.id
      });
    },
    clickRight2(event) {
      //console.log('clickRight2');
      this.triggerEvent('clickright2', {
        id: event.currentTarget.dataset.id
      });
    },

    showContractListPop({
      currentTarget: {
        dataset: {
          list
        }
      }
    }) {
      this.setData({
        cur_contract_list: list,
        contract_list_pop_show: true,
      })
    },

    passFollowApply({currentTarget:{dataset:{id}}}){
      this.triggerEvent('passFollowApply', {id});
    },

    unpassFollowApply({currentTarget:{dataset:{id}}}){
      this.triggerEvent('unpassFollowApply', {id});
    },
  }
})